public class test527_1 {
    public static void main(String[] args) {
        //数组的缩容（通过创建新的数组）
        int[] arr1 = {1,2,3,4,5,6,7};
        int delIndex = 4;
        int[] newArr1 = new int[arr1.length-1];
        for (int i = 0; i < delIndex; i++) {
            newArr1[i] = arr1[i];
        }
        for (int i = delIndex; i < newArr1.length; i++) {
            newArr1[i] = arr1[i + 1];
        }
        arr1 = newArr1;
        for (int i = 0; i < newArr1.length; i++) {
            System.out.print(arr1[i] + "\t");
        }
        System.out.println();
        //数组的反转
        int[] arr2 = {1,2,3,4,5};
        System.out.println("反转之前：");
        for (int i = 0; i < arr2.length; i++) {
            System.out.print(arr2[i] + "\t");
        }
        System.out.println();
        System.out.println("反转之后：");
        for (int i = 0 , j = arr2.length-1; i < j; i++ , j--) {
            int temp = arr2[i];
            arr2[i] = arr2[j];
            arr2[j] = temp;
        }
        //遍历
        for (int i = 0; i < arr2.length; i++) {
            System.out.print(arr2[i] + "\t");
        }
    }
}
